<?php

class infoController extends CController{
    
    public $model_name = LINK;
    
     public function BeforeLoad(){
        parent::BeforeLoad();
        $this->model->getMenu();
        $this->LoadModel('usuario/login', 'uobj');
        if(!$this->uobj->UserIsAdmin()){
            if(CURRENT_ACTION == "index" || CURRENT_ACTION == "refer" || CURRENT_ACTION == "show") return;
            throw new AcessDeniedException();
        }
    }
    
    public function index(){
        $this->model->Login();
        $this->registerVar('itens', $this->model->paginate(0));
        $this->display(LINK . "/index");
    }
    
    public function refer(){
        $this->LoadModel('usuario/login', 'uobj');
        $this->uobj->needLogin();
        Redirect(CURRENT_MODULE);
    }
    
}

?>
